<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img :src="this.bannerImg"
           class="banner-img" alt=""/>
      <div class="banner-info">
        <div class="banner-title">{{this.sightname}}</div>
        <div class="banner-number">
          <span class="iconfont imgicon">&#xe600;</span>
          {{this.gallaryImgs.length}}
        </div>
      </div>
    </div>
    <common-fade>
      <common-gallary
        :imgs="this.gallaryImgs"
        v-show="this.gallaryShow"
        @close="handleGallaryClose"
      ></common-gallary>
    </common-fade>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/gallary'
import CommonFade from 'common/fade/fade'
export default {
  name: 'DetailBanner',
  components: {
    CommonGallary,
    CommonFade
  },
  props: {
    sightname: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data () {
    return {
      gallaryShow: false
    }
  },
  methods: {
    handleBannerClick () {
      this.gallaryShow = true
    },
    handleGallaryClose () {
      this.gallaryShow = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    overflow: hidden;
    height: 0;
    padding-bottom: 55%;
    position: relative;
    .banner-img
      width: 100%
    .banner-info
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      line-height: .6rem;
      display: flex;
      color: #fff;
      background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
      .banner-title
        flex: 1;
        font-size: .32rem;
        padding: 0 .2rem;
      .banner-number
        padding: 0 .4rem;
        margin-top: .14rem;
        height: .4rem;
        line-height: .4rem;
        border-radius: .2rem;
        background: rgba(0, 0, 0, 0.8);
        margin-right:.2rem;
        .imgicon
          font-size: .24rem
          line-height: .4rem
</style>
